import time
import datetime
#计算日期之间间隔 day2-day1 [2021-9-09 2021-8-9]
def CalDay(date1,date2):
    date1 = time.strptime(str(date1),"%Y-%m-%d")
    date2 = time.strptime(str(date2), "%Y-%m-%d")
    date1 = datetime.datetime(date1[0],date1[1],date1[2])
    date2 = datetime.datetime(date2[0],date2[1],date2[2])
    return date2-date1

#计算日期
def AddDay(date,day):
    #print(date)
    date = time.strptime(str(date),"%Y-%m-%d")
    #print(date)
    date = datetime.datetime(date[0],date[1],date[2])
    #print(date)
    res_date = str(date + datetime.timedelta(day)).split(" ")[0]
    return res_date

